﻿<Window x:Class="MusicLibraryOrganizer.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:controls="clr-namespace:MusicLibraryOrganizer.Controls"
        xmlns:local="clr-namespace:MusicLibraryOrganizer"
    Title="Music Library Organizer" Height="600" Width="800">
  <Window.CommandBindings>
    <CommandBinding Command="local:MyCommands.AnalyzeLibrary" Executed="OnAnalyzeLibrary" />
  </Window.CommandBindings>

  <Window.Resources>
    <DataTemplate x:Key="songFileTemplate">
      <Border BorderBrush="Black" BorderThickness="2" CornerRadius="5">
        <StackPanel Orientation="Horizontal">
          <Label Content="{Binding FileLocation}" />
        </StackPanel>
      </Border>
    </DataTemplate>

    <DataTemplate x:Key="LibraryTemplate">
      <StackPanel>
        <TextBox IsReadOnly="True" Text="{Binding Name}" ToolTip="{Binding Path}" />
        <Button 
          x:Name="analyzeLibraryBtn" 
          Content="Analyze"
          Command="local:MyCommands.AnalyzeLibrary" 
          CommandParameter="{Binding Name}"
          />
        <TextBlock Text="{Binding Files.Count}"/>
      </StackPanel>
    </DataTemplate>

    <Style x:Key="ColumnBorderStyle" TargetType="Border">
      <Setter Property="BorderBrush" Value="Black"/>
      <Setter Property="BorderThickness" Value="2,0,2,0"/>
      <Setter Property="Padding" Value="5,0,5,0"/>
    </Style>


  </Window.Resources>

  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition/>
      <ColumnDefinition/>
      <ColumnDefinition/>
    </Grid.ColumnDefinitions>

    <Border Style="{StaticResource ColumnBorderStyle}">
      <HeaderedContentControl 
        Grid.Column="0"
        >
        <HeaderedContentControl.Header>
          <Grid >
            <TextBlock Text="Libraries" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0,0,0"/>
            <Button HorizontalAlignment="Right" x:Name="AddLibrary" Click="AddLibrary_Click" Margin="0,0,5,0" Content="+"/>
          </Grid>
        </HeaderedContentControl.Header>
        <StackPanel>
          <Border 
            x:Name="newLibraryBorder"
            Visibility="Collapsed"
            BorderBrush="Black"
            BorderThickness="0,1,0,3"
            Margin="5,10,5,0">
            <HeaderedContentControl Header="New Library">
              <Grid>
                <Grid.RowDefinitions>
                  <RowDefinition/>
                  <RowDefinition/>
                  <RowDefinition/>
                </Grid.RowDefinitions>
                <controls:WatermarkTextBox WatermarkBackground="White" Margin="0,5,0,5" Grid.Row="0" x:Name="newLibraryNameTxtBox" WatermarkText="Name"/>
                <controls:WatermarkTextBox WatermarkBackground="White"  Grid.Row="1" x:Name="newLibraryPathTxtBox" WatermarkText="Path" Margin="0,5,25,5"/>
                <Button 
                  Margin="0,5,0,5"
                  x:Name="BrowseBtn" 
                  Content="..." 
                  Grid.Row="1"
                  HorizontalAlignment="Right"
                  Width="25"
                  Click="BrowseBtn_Click"
                  />
                <Button 
                  Width="75" 
                  x:Name="CreateNewLibraryBtn" 
                  Click="CreateNewLibraryBtn_Click" 
                  Grid.Row="2" 
                  HorizontalAlignment="Right"
                  Content="Create!"
                  />
              </Grid>
            </HeaderedContentControl>
          </Border>

          <ListBox 
            BorderThickness="0"
            Margin="0,10,0,0"
            x:Name="SourcesListBox"
            ItemTemplate="{StaticResource LibraryTemplate}"
            VerticalAlignment="Stretch"
            />
        </StackPanel>
      </HeaderedContentControl>
    </Border>

    <Border Grid.Column="1" Style="{StaticResource ColumnBorderStyle}">
      <HeaderedContentControl>
        <HeaderedContentControl.Header>
          <TextBlock HorizontalAlignment="Center" Text="Merge Settings"/>
        </HeaderedContentControl.Header>
      </HeaderedContentControl>
    </Border>


    <!--<StackPanel Orientation="Horizontal">
            <TextBox Height="23"  Name="txtDir" VerticalAlignment="Top" HorizontalAlignment="Left" Width="120" />
            <Button Height="23" HorizontalAlignment="Right" Name="button1" VerticalAlignment="Top" Width="102" Click="button1_Click">
                Load Directory
            </Button>
        </StackPanel>
        
        
        <ListView x:Name="myListBox" 
                 ItemsSource="{Binding Files, Mode=OneWay}" 
                 ItemTemplate="{StaticResource songFileTemplate}" ScrollViewer.VerticalScrollBarVisibility="Auto" />-->

  </Grid>
</Window>
